package malagaAcoge.utils;

import java.util.List;

import javax.persistence.EntityManager;
import javax.persistence.EntityManagerFactory;
import javax.persistence.Persistence;
import javax.persistence.Query;

import malagaAcoge.model.entities.Abogado;

public class Test {
	private static final String PERSISTENCE_UNIT_NAME = "pfcmalagaacoge";
	private static EntityManagerFactory factory;

	public static void main(String[] args) {
		factory = Persistence.createEntityManagerFactory(PERSISTENCE_UNIT_NAME);
		EntityManager em = factory.createEntityManager();

		Query q = em.createQuery("select a from Abogado a");
		List<Abogado> list = q.getResultList();
		for (Abogado abogado : list) {
			System.out.println(abogado);
		}
		System.out.println("Size: " + list.size());
		em.close();
	}

}
